package com.javasm.bootdemo.common.config;

import com.javasm.bootdemo.common.interceptor.LoginInterceptors;
import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
public class JavasmWebConfiguration implements WebMvcConfigurer {
    @Resource
    private LoginInterceptors loginInterceptors;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptors)
            .addPathPatterns("/**")
            .excludePathPatterns("/login/**", "/error");
    }
}
